package com.mnkjxy.beauty.net.protocal;

import org.xmlpull.v1.XmlSerializer;

public class Leaf {

	private String tagName;
	private String tagValue = "";

	/**
	 * 节点名称
	 * 
	 * @param tagName
	 */
	public Leaf(String tagName) {
		this.tagName = tagName;
	}

	/**
	 * 
	 * 
	 * @param tagName
	 *            节点名称
	 * @param tagValue
	 *            节点值
	 */
	public Leaf(String tagName, String tagValue) {
		this.tagName = tagName;
		this.tagValue = tagValue;
	}

	/**
	 * 序列化叶子节点
	 * 
	 * @param serializer
	 */
	public void serializerLeaf(XmlSerializer serializer) {
		try {
			serializer.startTag(null, tagName);
			serializer.text(tagValue);
			serializer.endTag(null, tagName);
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

	/**
	 * 设置叶子节点的值
	 * 
	 * @param tagValue
	 */
	public void setTagValue(String tagValue) {
		this.tagValue = tagValue;
	}

}
